from django.db import models

class Book (models.Model):
    title = models.CharField(max_length=100)
    genre = models.CharField(max_length=100)

# cube declaration
from cube.models import Cube, Dimension

class BookCaseCube(Cube):

    genre = Dimension('genre')
    first_letter_title = Dimension('title__iregex', sample_space=[r'^[a-n]', r'^[m-z]'])

    @staticmethod
    def aggregation(queryset):
        return queryset.count()
